import router from '../router'
import store from '../store'

// const whiteList = ['/login', '/404']

router.beforeEach((to, from, next) => {
  if (to.matched.some((e) => e.meta.isLogin)) {
    const token = store.state.login.userInfo.token
    if (token) {
      next()
    } else {
      next('/login')
    }
  } else {
    next()
  }
})

router.afterEach(() => {})
